home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pcl4p34.zip / HEX_IO.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-24  |  834b  |  34 lines

  1. (*********************************************)
  2. (*                                           *)
  3. (*  This program is donated to the Public    *)
  4. (*  Domain by MarshallSoft Computing, Inc.   *)
  5. (*  It is provided as an example of the use  *)
  6. (*  of the Personal Communications Library.  *)
  7. (*                                           *)
  8. (*********************************************)
  9.  
  10. unit hex_io;
  11.  
  12. interface
  13.  
  14. Procedure WriteHexByte(Data:Byte);
  15. Procedure WriteHexWord(Data:Word);
  16.  
  17. implementation
  18.  
  19. uses PCL4P, crt;
  20.  
  21. Procedure WriteHexByte(Data:Byte);
  22. const HexChars: array[0..15] of char = '0123456789ABCDEF';
  23. begin
  24.   write( HexChars[Data SHR 4] );
  25.   write( HexChars[Data AND $0F] );
  26. end;
  27.  
  28. Procedure WriteHexWord(Data:Word);
  29. begin
  30.   WriteHexByte(Data SHR 8);
  31.   WriteHexByte(Data AND $00FF)
  32. end;
  33.  
  34. end.